/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//显示微信图片
window.onload = function () {
    var xPos = 10;
    var yPos = 20;
    if (!document.getElementsByTagName) {
        return false;
    }

    //var links = document.getElementsByTagName("img");
    var links = document.getElementsByClassName("weichat_img");
    for (var i = 0, len = links.length; i < len; i++) {

        links[i].onmouseover = function (e) {
            //获取大图的地址，将大图装入img元素http://derong.b0.upaiyun.com/tianxia_051fb670-b21f-4f32-bd23-91bf3e650e9a
            //var imgUrl = this.getAttribute("src");
            var bigger = document.createElement("img");
            bigger.setAttribute("src", "/img/hot.png");
            //为大图设置id，为删除此元素做准备，将大图加到文档
            bigger.setAttribute("id", "bigger");
            bigger.setAttribute("width", "80px");
            bigger.setAttribute("height", "80px");
            document.body.appendChild(bigger);
            //兼容的获取鼠标位置，并复制给大图
            var x = e.pageX || (e.clientX +
                    (document.documentElement.scrollLeft
                            || document.body.scrollLeft));
            var y = e.pageY || (e.clientY +
                    (document.documentElement.scrollTop
                            || document.body.scrollTop));
            bigger.style.top = (y + yPos) + "px";
            bigger.style.left = (x + xPos) + "px";
            bigger.style.position = "absolute";
        };
        links[i].onmouseout = function (e) {
            //找到大图所在元素，从文档中删除元素节点
            var elem = document.getElementById("bigger");
            document.body.removeChild(elem);
        };
        //通过设置mousemove使得大图随鼠标在元素上移动
        links[i].onmousemove = function (e) {
            var elem = document.getElementById("bigger");
            var x = e.pageX || (e.clientX +
                    (document.documentElement.scrollLeft
                            || document.body.scrollLeft));
            var y = e.pageY || (e.clientY +
                    (document.documentElement.scrollTop
                            || document.body.scrollTop));

            if (elem != null) {
                elem.style.left = (x + xPos) + "px";
                elem.style.top = (y + yPos) + "px";
            }

        };
    }
    $(".order_number").click(function () {

        $("#BgDiv").css({display: "block", height: $(document).height(), width: $(document).width(), position: "absolute", top: "0", background: "#ecebeb", opacity: "0.6"});
        $(".order_info_modal").show();
        document.documentElement.scrollTop = 60;
    });
    $(".order_modal_shutdown").click(function () {
        $(".order_info_modal").hide();
        $("#BgDiv").hide();
    });
}


